Skip to content

kb: register the KB embedder and reranker; reranker template in config/ - #17

Merged
pctablet505 merged 3 commits into
mainfrom
kb-reranker-template
Nov 21, 2026
Merged

pctablet505 merged 3 commits into
mainfrom
kb-reranker-template

Conversation

@pctablet505

@pctablet505 pctablet505 commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

What

  • models.toml: the two pooling models the hub's knowledge base uses.
    • kb-emb-qwen3-8b: Qwen3-Embedding-8B on :8021.
    • kb-rr-qwen3-4b: Qwen3-Reranker-4B on :8029.
    • Both entries are as the box runs them today. Until now they existed only in the deployed checkout's uncommitted
      models.toml.
    • One change from that copy: the reranker's --chat-template now points at config/qwen3_reranker.jinja instead of
      a scratch folder.
    • The comments say how much VRAM the pair holds next to a main model (about 32,304 MiB, opt-in like lfm2), and that
      the VRAM budgets are estimates.
  • config/qwen3_reranker.jinja: vLLM v0.32.0's template, byte-identical to the file the reranker reads today
    (sha256 e1ee98e69aab7b2d…).
  • servedeck/wire.py: a pooling model answers /v1/embeddings or /v1/rerank, never chat completions.
    • A model counts as pooling when served with --runner pooling, or with --convert embed|classify|reward, written
      with a space or with =. As in vLLM's argparse, the last value wins.
    • wire leaves such a model out of the VS Code and Kimi configs, and retires a Kimi table that servedeck wrote for
      one earlier. Codex output is unchanged, because it reads main-slot models only.
  • servedeck/discovery.py: Qwen3ForCausalLM, the architecture of both KB checkpoints, is now a known
    architecture, with its own label qwen3, so the map stays 1:1.
    • Without this, doctor failed both weights rows, and the dashboard offered neither model, even though both were
      complete in the hub cache.
  • Docs:
    • CLIENTS.md: Kimi gets one table per chat model, and the one embedder on the box is the KB's.
    • CONFIGURATION.md: the flags row names the pooling spellings.

Deterministic gate

Each tree ran with its own editable .venv, as in CI, through the box's test scheduler with 4 workers and the same
invocation every time.

  • Full suite:
    • main: 1,297 passed, 63 skipped, 0 failed;
    • this branch: 1,309 passed, 63 skipped, 0 failed.
    • An earlier run used another checkout's venv. It skipped the 16 console-script tests, so those numbers are dropped.
  • Fail-before:
    • main's wire.py against this branch's registry and tests: 2 failed;
    • the review-fix tests against the first commit's code: 7 failed (2 discovery, 5 flag spellings).
  • Mutants: each one-line defect turns a test red, and the restored code gives 142 passed in the three files:
    • _chats always true;
    • the Kimi keep-set without the filter;
    • the Kimi loop without the filter;
    • the VS Code loop without the filter;
    • a loose _chats (--runner present means pooling);
    • no = spelling;
    • the first value wins;
    • embed not counted as pooling;
    • the architecture entry removed;
    • the template file deleted.
  • Docs: mkdocs build --strict with out-of-tree output exits 0.

Review gate

Pass-1, author-blind diff audit (a fresh reviewer with no authoring history, which read no PR prose): no Blocker,
3 Warnings, 6 Nits.

Pass-2, what happened to each finding:

Finding Result Proof
Warning: the KB models show as unservable (Qwen3ForCausalLM not in KNOWN_ARCHS) VERIFIED, fixed test_the_knowledge_base_pooling_checkpoints_are_servable fails before the fix and passes after; the mutant that removes the entry turns 2 tests red
Warning: _chats misses --runner=pooling and --convert embed, and a loose _chats survived the tests VERIFIED, fixed the 9-case test_a_model_is_wired_unless_its_flags_make_it_a_pooling_model: 5 cases fail before the fix; 4 mutants red, including the loose one
Warning: the reranker's template path points into the control plane's checkout DISPUTED_WITH_PROOF, (b) caller-complete see below
Nit: docs say Kimi gets a table per registry model, that nothing here serves embeddings, and nothing about pooling flags fixed CLIENTS.md, CONFIGURATION.md
Nit: the VRAM interplay with main models is not written down fixed models.toml comment, 32,304 MiB = ceil(97887 × 0.21) + ceil(97887 × 0.12)
Nit: "8.06 GB", and VRAM budgets not labelled fixed 8.04 GB (8,043,614,960 B of safetensors); budgets marked as estimates
Nit: comments cite private files fixed removed
Nit: a request that names no model can reach a pooling resident when the main slot is down not fixed here follow-up below
Nit: the upstream template drops one trailing newline no change upstream behaviour; the file is byte-identical to vLLM v0.32.0

Why the template path stands (Warning 1):

  • The only reader of models.toml is the daemon. It reads PROJECT_ROOT / "models.toml" (servedeck/settings.py:47,
    :141).
  • servedeck.service runs with WorkingDirectory=%h/Projects/servedeck and
    ExecStart=%h/Projects/servedeck/.venv/bin/python -m servedeck, and sets no SERVEDECK_MODELS.
  • So the flag names a file in the same checkout as the models.toml that holds the flag, and this commit adds both
    together.
  • models.toml already holds host paths for this box (:375-378, :593).
  • test_the_kb_reranker_chat_template_is_a_file_this_repo_keeps pins the path and the file's sha256. A one-byte change
    turns it red.

Confirm pass (the same reviewer, on the fix commit only): ACCEPT, with two Nits.

  • With the daemon down, servedeck start acting directly from another checkout, or a SERVEDECK_MODELS override,
    reads that checkout's models.toml while the flag names the control plane's file. Noted, not changed. After the merge
    both copies are the same file.
  • The guard should pin the property, not only the path. Done in 184cb18: the sha256 of vLLM v0.32.0's template.

The reviewer's own run of the suite, without the 4 e2e modules, gave 1,297 passed, 23 skipped, 0 failed. My counts
include those modules, which skip in the sandbox.

Follow-ups (not in this PR)

  • The gateway's model-less fallback (servedeck/gateway.py:553-561): a request that names no model goes to
    live[0] when the main slot is down. With only a KB resident live, that request reaches a pooling engine.
    /v1/models also lists the pooling ids when they are live. The deployed box behaves the same way today, because the
    same entries already sit in its models.toml.
  • Model pages for the two KB entries.

COULD NOT VERIFY

  • A GPU boot of either model with these flags, and the reranker's scores with this template. Nothing was deployed.
  • That the vram_mib budgets are enough at 8,192 context and 16,384 batched tokens.
  • /v1/embeddings through the gateway for the embedder. The hub calls the model's port directly.
  • The GPU and systemd e2e modules, which CI excludes.

Deploy (not done; the owner's)

  1. Merge, then bring the deployed checkout to a commit that has this change. Its uncommitted models.toml holds the
    same two entries with the old template path. Drop that copy when updating, or the tables clash.
  2. Restart. The daemon reads models.toml only at start:
    • servedeck stop kb-rr-qwen3-4b if it is running;
    • restart servedeck.service, but only when no client is using the gateway;
    • servedeck start kb-rr-qwen3-4b when the KB needs it.
  3. Confirm:
    • ps -eo args for the reranker's vLLM process shows config/qwen3_reranker.jinja;
    • a /v1/rerank call on :8029 answers;
    • servedeck doctor shows both weights rows OK.

- models.toml: the kb-emb-qwen3-8b (:8021) and kb-rr-qwen3-4b (:8029)
  pooling entries that the hub's knowledge base names, as the box runs
  them. Until now they existed only in the deployed checkout's
  uncommitted models.toml. The reranker's --chat-template now points at
  config/qwen3_reranker.jinja instead of a scratch folder.
- config/qwen3_reranker.jinja: vLLM v0.32.0's template, byte-identical to
  the file the box serves today (sha256 e1ee98e6...).
- wire: a model served with --runner pooling answers /v1/embeddings or
  /v1/rerank and never chat completions, so no client config lists it,
  and a Kimi table that servedeck wrote for one is retired. Without this,
  `servedeck wire` would add both models to VS Code and Kimi as chat
  models.
- tests: the registry pins now count 9 models. A new test shows that
  neither VS Code nor Kimi lists a pooling model, and that a stale Kimi
  table is retired; it fails on the old wire.py.
…ling spelling

Review fixes on the KB block:
- discovery: Qwen3ForCausalLM, the architecture of both KB checkpoints, is a
  known one (label qwen3; the map stays 1:1). Unmapped, doctor failed both
  weights rows and the dashboard offered neither, though both were complete
  in the hub cache.
- wire: a model is a pooling model for --runner pooling or --convert
  embed|classify|reward, written with a space or with =, the last value
  winning as in vLLM's argparse. Before, only the two-token --runner pooling
  was seen.
- tests: the KB checkpoints are servable; nine flag spellings, each wired
  exactly when it chats; the reranker's chat template is a file this repo
  keeps.
- docs: Kimi gets a table per chat model; the one embedder here is the KB's;
  the flags row names the pooling spellings.
- models.toml comments: no private paths, 8.04 GB, the VRAM budgets marked as
  estimates, and the 32,304 MiB the pair holds beside a main model.
The guard now also turns red when the repo copy drifts from vLLM v0.32.0's
qwen3_reranker.jinja, not only when the file is gone.
@pctablet505
pctablet505 marked this pull request as ready for review November 21, 2026 13:17
@pctablet505
pctablet505 merged commit 937c763 into main Nov 21, 2026
3 checks passed
pctablet505 added a commit that referenced this pull request Dec 3, 2026
Both sides appended at the same places: the Nemotron entry and the KB pair are both kept in models.toml, discovery's architecture map and their tests; the registry now has 10 models and wire lists 12 ids (the KB pooling models never).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant